<?php

class table_model {
    function list_table(){
        return array("product","news","auction");
    }
    function configs($table){
        if ($table=="product")
            return array(
                "title"     =>"Product",
                "table"     =>"product",
                "n"     =>10,
                "model"     =>"product_model",
                "cols"      =>array(
                    "id"=>array(
                        "field"     =>"id",
                        "title"     =>"ID",
                        "type"      =>"text"
                        
                    ),
                    "name"=>array(
                        "field"     =>"name",
                        "title"     =>"Name",
                        "type"      =>"text",
                        "group"     =>"concat(LEFT(`name`,1),'...')",
                        "minw"      =>180
                    ),
                    "status"=>array(
                        "field"     =>"status",
                        "title"     =>"Status",
                        "type"      =>"status",
                        "minw"      =>100
                    ),
                    "game"=>array(
                        "field"     =>"game",
                        "title"     =>"Game",
                        "type"      =>"data",
                        "group"     =>"`game`",
                        "data"      =>array("Bong Da","VVCV","Ngao Kiem"),
                        "minw"      =>100
                    ),
                    "type"=>array(
                        "field"     =>"type",
                        "title"     =>"Type",
                        "type"      =>"data",
                        "group"     =>"`type`",
                        "data"      =>array("Phone","Laptop","Giftcode"),
                        "minw"      =>100
                    ),
                    "insert"=>array(
                        "field"     =>"insert",
                        "title"     =>"Insert",
                        "type"      =>"datetime",
                        "minw"      =>80
                    ),
                    "update"=>array(
                        "field"     =>"update",
                        "title"     =>"Update",
                        "type"      =>"datetime",
                        "minw"      =>80
                    )
                )
            );
        elseif ($table=="news")
            return array(
                "title"     =>"News",
                "table"     =>"news",
                "n"     =>10,
                "model"     =>"news2_model",
                "cols"      =>array(
                    "id"=>array(
                        "field"     =>"id",
                        "title"     =>"ID",
                        "type"      =>"text"
                        
                    ),
                    "title"=>array(
                        "field"     =>"title",
                        "title"     =>"Title",
                        "type"      =>"text",
                        "group"     =>"concat(LEFT(`title`,1),'...')",
                        "minw"      =>180
                    ),
                    "status"=>array(
                        "field"     =>"status",
                        "title"     =>"Status",
                        "type"      =>"status",
                        "minw"      =>100
                    ),
                    "insert"=>array(
                        "field"     =>"insert",
                        "title"     =>"Insert",
                        "type"      =>"datetime",
                        "minw"      =>80
                    ),
                    "update"=>array(
                        "field"     =>"update",
                        "title"     =>"Update",
                        "type"      =>"datetime",
                        "minw"      =>80
                    )
                )
            );
        elseif ($table=="auction")
            return array(
                "title"     =>"Product Auction",
                "table"     =>"product",
                "n"     =>10,
                "model"     =>"product_model",
                "cols"      =>array(
                    "id"=>array(
                        "field"     =>"id",
                        "title"     =>"ID",
                        "type"      =>"text"
                        
                    ),
                    "name"=>array(
                        "field"     =>"name",
                        "title"     =>"Name",
                        "type"      =>"text",
                        "group"     =>"concat(LEFT(`name`,1),'...')",
                        "minw"      =>180
                    ),
                    "startdate"=>array(
                        "field"     =>"startdate",
                        "title"     =>"Start Date",
                        "type"      =>"datetime",
                        "minw"      =>100
                    ),
                    "enddate"=>array(
                        "field"     =>"enddate",
                        "title"     =>"End Date",
                        "type"      =>"datetime",
                        "minw"      =>100
                    ),
                    "game"=>array(
                        "field"     =>"game",
                        "title"     =>"Game",
                        "type"      =>"data",
                        "group"     =>"`game`",
                        "data"      =>array("Bong Da","VVCV","Ngao Kiem"),
                        "minw"      =>100
                    )
                )
            );
        elseif ($table=="product_auction")
            return array(
                "title"     =>"Product Auction",
                "table"     =>"auction",
                "n"     =>10,
                "model"     =>"auction_model",
                "cols"      =>array(
                    "id"=>array(
                        "field"     =>"id",
                        "title"     =>"ID",
                        "type"      =>"text"
                        
                    ),
                    "orderid"=>array(
                        "field"     =>"orderid",
                        "title"     =>"Order ID",
                        "type"      =>"text"
                    ),
                    "userid"=>array(
                        "field"     =>"userid",
                        "title"     =>"UserID",
                        "type"      =>"text"
                    ),
                    "username"=>array(
                        "field"     =>"username",
                        "title"     =>"User Name",
                        "type"      =>"text"
                    ),
                    "email"=>array(
                        "field"     =>"email",
                        "title"     =>"Email",
                        "type"      =>"text",
                        "minw"      =>100
                    ),
                    "cash"=>array(
                        "field"     =>"cash",
                        "title"     =>"Cash",
                        "type"      =>"number"
                    ),
                    "insert"=>array(
                        "field"     =>"insert",
                        "title"     =>"Insert",
                        "type"      =>"datetime",
                        "minw"      =>80
                    )
                )
            );
    }
   
    
}
?>
